/* This program displays the Character Speed WPM on line 1 and Character Clock Timing on line 2 of a 16 x 2 LCD display based on a HD44780 display controller. WA7RSO Modified for Analog Input & Display of the Voltage on LCD LLine 3 08/13/2013 */ #include // alert compiler to include the lcd library int RS = 8; // Register Select on pin #4 of the LCD int RW = 9; // Read/Write on pin #5 of the LCD int E = 10; // Enable on pin #6 of the LCD // initialize the library with the numbers of the Arduino pins used LiquidCrystal lcd(RS, E, 4, 5, 6, 7); //defines the pins used from the LCD to the Arduino (New Interface Board) int rawNumber; String CharSpeed20 = ("Char Speed-20WPM"); String CharClock20 = ("60 ms 16.7Hz Clk"); String InputVoltage; void setup() //required function { // initialize serial communication at 9600 bits per second: // Serial.begin(9600); //see text pinMode(RW, OUTPUT); digitalWrite(RW, LOW); // Allow "Writing" to the LCD lcd.begin(20,4); //let the program know the size of the display to be handled printspeed(); // calls the function to print the WPM message // printclock(); // calls the function to print the first 16 characters of the message } void loop() // Dummy Loop { // Read the analog input on pin #0 int sensorValue = analogRead(A0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): float voltage = sensorValue * (5.0 / 1023.0); // print out the value you read: // Serial.println(voltage); lcd.setCursor(0,2); // InputVoltage = Stringvoltage; lcd.print("Voltage: "); lcd.print(voltage); lcd.print("V"); Clear4thLine(); lcd.setCursor(0,3); rawNumber = sensorValue; lcd.print("Raw Value: "); lcd.print(String(sensorValue)); delay(500); } void printspeed() // Show the Character Speed in WPM { lcd.setCursor (0,0); // Set cursor at beginning of 1st Row ("0") lcd.print(CharSpeed20); // print the WPM Character Speed Serial.println(CharSpeed20); lcd.setCursor(0,1); //sets cursor at the bginning of the second line and then moves right lcd.print(CharClock20); Serial.println(CharClock20); } void Clear4thLine() { lcd.setCursor(0,3); lcd.print(" "); }